<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Algorithms</h1>

<c:url var="editImgUrl" value="/resources/img/edit.png" />
<c:url var="deleteImgUrl" value="/resources/img/delete.png" />
<c:url var="addUrl" value="/thesis/main/algorithms/add" />
<table style="border: 1px solid; width: 100%; text-align:center">
	<thead style="background:#d3dce3">
		<tr>
			<th>Description</th>
			<th>Name</th>
			<th>Class Name</th>
			<th>Data Type ID</th>
			<th colspan="3"></th>
		</tr>
	</thead>
	<tbody style="background:#ccc">
	<c:forEach items="${algorithms}" var="algorithm">
			<c:url var="editUrl" value="/thesis/main/algorithms/edit?id=${algorithm.id}" />
			<c:url var="deleteUrl" value="/thesis/main/algorithms/delete?id=${algorithm.id}" />
		<tr>
			<td><c:out value="${algorithm.description}" /></td>
			<td><c:out value="${algorithm.name}" /></td>
			<td><c:out value="${algorithm.className}" /></td>
			<td><c:out value="${algorithm.datatype.id}" /></td>
			<td><a href="${editUrl}"><img src="${editImgUrl}"></a></td>
			<td><a href="${deleteUrl}"><img src="${deleteImgUrl}"></a></td>
			<td><a href="${addUrl}">+</a></td>
		</tr>
	</c:forEach>
	</tbody>
</table>

<c:if test="${empty algorithms}">
	There are currently no algorithms in the list. <a href="${addUrl}">Add</a> an Algorithm.
</c:if>

<br>
    	<c:url var="serverUrl" value="/thesis/main/hello.htm" />
    	<td><a href="${serverUrl}">Server Management</a></td>
    	<br>
    	<c:url var="userUrl" value="/thesis/main/persons/" />
    	<td><a href="${userUrl}">User Management</a></td>
    	<br>
    	<c:url var="dataUrl" value="/thesis/main/datatypes/" />
    	<td><a href="${dataUrl}">Data Type Management</a></td>
    	<br>
    	<c:url var="recordUrl" value="/thesis/main/records/" />
    	<td><a href="${recordUrl}">Records Management</a></td>

</body>
</html>